<!-- classify -->
<template>
  <div>
    <el-collapse style="margin: 20px 10px" accordion>
      <el-collapse-item v-for="(item, index) in classifyList" :key="index">
        <template slot="title">
          <span>{{ item.classify }}</span>
        </template>
        <el-tag v-for="(tag, tindex) in item.list" :key="tindex" type="primary" style="margin: 10px 10px 0 0" size="medium"><span class="tag" @click="clickTag(tag.value)">{{ tag.value }}</span></el-tag>
      </el-collapse-item>
    </el-collapse>
  </div>
</template>

<script>
export default {
  name: 'classify',
  data() {
    return {
      classifyList: []
    }
  },
  mounted() {
    this.getClassifyList()
  },
  methods: {
    getClassifyList() {
      this.$get('/parameter/classify-list').then(res => {
        this.classifyList = res.data
      })
    },
    clickTag(value) {
      this.$router.push({
        path: '/home',
        query: {searchClassify: value}
      })
    }
  }
}
</script>
<style lang='scss' scoped>
.tag {
  cursor: pointer;
}
</style>
